﻿using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zocono.Infrastructure.Common;
using Zocono.WCS.Domain.EquipmentManageDomain;
using Zocono.WCS.Infrastructure.ApllicationDto;
using Zocono.WCS.Infrastructure.ApllicationDto.DtoWcsManage;

namespace Zocono.WCS.Application.AppEquipmentManage
{
    public class EquipmentApp
    {
        private readonly IMapper _Mapper;
        private readonly IDispatchEquipmentService _DispatchEquipmentservice;
        private readonly IEquipmentTypeService _EquipmentTypeservice;


        public EquipmentApp(IDispatchEquipmentService DispatchEquipmentservice, IMapper mapper, IEquipmentTypeService EquipmentTypeservice)
        {
            _Mapper = mapper;
            _DispatchEquipmentservice = DispatchEquipmentservice;
            _EquipmentTypeservice = EquipmentTypeservice;
        }

        #region 调度设备
        public async Task<long> AddDispatchEquipmentAsync(DispatchEquipmentInfoDto dispatchEquipmentInfoDto)
        {
            dispatchEquipmentInfoDto.ObjectIsNullOrEmpty();//数据非空验证
            return await _DispatchEquipmentservice.AddDispatchEquipmentAsync(dispatchEquipmentInfoDto);
        }

        public async Task<bool> DeleteDispatchEquipmentAsync(long ID)
        {
            return await _DispatchEquipmentservice.DeleteDispatchEquipmentAsync(ID);
        }

        public async Task<bool> UpdateDispatchEquipmentAsync(DispatchEquipmentInfoDto dispatchEquipmentInfoDto)
        {
            dispatchEquipmentInfoDto.ObjectIsNullOrEmpty();
            return await _DispatchEquipmentservice.UpdateDispatchEquipmentAsync(dispatchEquipmentInfoDto);
        }

        public async Task<PageDto<DispatchEquipmentInfoDto>> GetDispatchEquipmentAsync(QueryDispatchEquipmentInfoDto queryDispatchEquipmentInfoDto)
        {
            return await _DispatchEquipmentservice.GetDispatchEquipmentAsync(queryDispatchEquipmentInfoDto);
        }
        public async Task<DispatchEquipmentInfoDto> GetDispatchEquipmentByIDAsync(long ID)
        {
            return await _DispatchEquipmentservice.GetDispatchEquipmentByIDAsync(ID);
        }

        public async Task<List<DispatchEquipmentInfoDto>> GetALlDispatchEquipmentAsync()
        {
            return await _DispatchEquipmentservice.GetAllDispatchEquipmentAsync();
        }

        #endregion

        #region 设备类型
        public async Task<long> AddEquipmentTypeAsync(EquipmentTypeInfoDto EquipmentTypeInfoDto)
        {
            EquipmentTypeInfoDto.ObjectIsNullOrEmpty();//数据非空验证
            return await _EquipmentTypeservice.AddEquipmentTypeAsync(EquipmentTypeInfoDto);
        }

        public async Task<bool> DeleteEquipmentTypeAsync(long ID)
        {
            return await _EquipmentTypeservice.DeleteEquipmentTypeAsync(ID);
        }

        public async Task<bool> UpdateEquipmentTypeAsync(EquipmentTypeInfoDto EquipmentTypeInfoDto)
        {
            EquipmentTypeInfoDto.ObjectIsNullOrEmpty();
            return await _EquipmentTypeservice.UpdateEquipmentTypeAsync(EquipmentTypeInfoDto);
        }

        public async Task<List<EquipmentTypeInfoDto>> GetEquipmentTypeAsync(QueryEquipmentTypeInfoDto queryEquipmentTypeInfoDto)
        {
            return await _EquipmentTypeservice.GetEquipmentTypeAsync(queryEquipmentTypeInfoDto);
        }

        public async Task<EquipmentTypeInfoDto> GetEquipmentTypeByIDAsync(long ID)
        {
            return await _EquipmentTypeservice.GetEquipmentTypeByIDAsync(ID);
        }

        public async Task<List<EquipmentTypeInfoDto>> GetAllEquipmentTypeAsync()
        {
            return await _EquipmentTypeservice.GetAllEquipmentTypeAsync();
        }
        #endregion 
    }
}
